new.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { useParams } from 'common'
  2. import { useRouter } from 'next/router'
  3. import { SidePanelEditor } from '@/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor'
  4. import { DefaultLayout } from '@/components/layouts/DefaultLayout'
  5. import { EditorBaseLayout } from '@/components/layouts/editors/EditorBaseLayout'
  6. import { TableEditorLayout } from '@/components/layouts/TableEditorLayout/TableEditorLayout'
  7. import { TableEditorMenu } from '@/components/layouts/TableEditorLayout/TableEditorMenu'
  8. import { NewTab } from '@/components/layouts/Tabs/NewTab'
  9. import type { NextPageWithLayout } from '@/types'
  10. const EditorNewPage: NextPageWithLayout = () => {
  11. const router = useRouter()
  12. const { ref: projectRef } = useParams()
  13. const onTableCreated = (table: { id: number }) => {
  14. router.push(`/project/${projectRef}/editor/${table.id}`)
  15. }
  16. return (
  17. <>
  18. <NewTab />
  19. <SidePanelEditor onTableCreated={onTableCreated} />
  20. </>
  21. )
  22. }
  23. EditorNewPage.getLayout = (page) => (
  24. <DefaultLayout>
  25. <EditorBaseLayout
  26. productMenu={<TableEditorMenu />}
  27. product="Table Editor"
  28. productMenuClassName="overflow-y-hidden"
  29. >
  30. <TableEditorLayout>{page}</TableEditorLayout>
  31. </EditorBaseLayout>
  32. </DefaultLayout>
  33. )
  34. export default EditorNewPage